<template>
	
	
  <view>
    <!-- <cmd-nav-bar back title="信息设置"></cmd-nav-bar> -->
    <cmd-page-body type="body">
      <cmd-transition name="fade-up">
        <view>
          <cmd-cel-item title="xxx1" slot-right arrow></cmd-cel-item>
          <cmd-cel-item title="xxx2"  arrow @click="fnClick('nickname')"></cmd-cel-item>
          <cmd-cel-item title="xxx3"  arrow @click="fnClick('name')"></cmd-cel-item>
		   <cmd-cel-item title="xxx4"  arrow @click="fnClick('name')"></cmd-cel-item>
        </view>
		
		<view class="btn-body">
			 <button class="btn-logout" @click="logout">退出登录</button>
		</view>
		 
		 	
      </cmd-transition>
	 
    </cmd-page-body>
	

	 	
  </view>
</template>

<script>
  import cmdNavBar from "@/components/PersonPage/cmd-nav-bar/cmd-nav-bar.vue"
  import cmdPageBody from "@/components/PersonPage/cmd-page-body/cmd-page-body.vue"
  import cmdTransition from "@/components/PersonPage/cmd-transition/cmd-transition.vue"
  import cmdCelItem from "@/components/PersonPage/cmd-cell-item/cmd-cell-item.vue"
  import cmdAvatar from "@/components/PersonPage/cmd-avatar/cmd-avatar.vue"

  export default {
    components: {
      cmdNavBar,
      cmdPageBody,
      cmdTransition,
      cmdCelItem,
      cmdAvatar
    },

    data() {
      return {};
    },

    mounted() {},
    
    methods:{
      /**
       * 点击触发
       * @param {Object} type 跳转页面名或者类型方式
       */
      fnClick(type){
        if(type == 'modify'){
          uni.navigateTo({
            url:'/pages/sub/person/modify/modify'
          })
        }
		if(type == 'nickname'){
		  uni.navigateTo({
		    url:'/pages/sub/person/modify/modify/{}'
		  })
		}
		if(type == 'name'){
		  uni.navigateTo({
		    url:'/pages/sub/person/modify/modify/{}'
		  })
		}
      },
	  logout(){
		  // 清楚token
		    uni.removeStorageSync('token');
		    
		    // 2. 清除全局变量中的登录状态
		    // getApp().globalData.isLogged = false;
		  
		    // 清除其他相关的缓存数据
		    // ...
		  
		    // 跳转到登录页面（假设登录页的路径为 /pages/login/login）
		    wx.redirectTo({
		      url: '/pages/login/login'
		    });
	  }
    }
  }
</script>

<style>
	
	.btn-body{
		height: 0upx;
	}
  .btn-logout {
	
    top: 100upx;
    width: 80%;
    border-radius: 50upx;
    font-size: 16px;
    color: #fff;
    background: linear-gradient(to right, #365fff, #36bbff);
  }

  .btn-logout-hover {
    background: linear-gradient(to right, #365fdd, #36bbfa);
  }
</style>
